<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="UTF-8">
    <title>预约-医生</title>
    <base th:href="@{http://localhost:9090/}"/>
    <link th:href="@{/bs/css/bootstrap.css}" rel="stylesheet">
    <script th:src="@{/js/jquery-3.2.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/bs/js/bootstrap.js}" type="text/javascript"></script>
    <style type="text/css">
        #body{
            width: 1200px;
            margin: 0 auto;
        }
        h1{
            width: 200px;
            margin: 0 auto;
            color: red;
        }
    </style>
    <script type="text/javascript">
        $(function (){
            var depId="[[${departmentId}]]";

            $.ajax({
                url: "/dmy/getDocListByDepartmentId",
                type: "GET",
                data: "departmentId=" + depId ,
                dataType: "json",
                success:function(doctorList){
                    if (doctorList!=null){
                        show(doctorList);
                    }
                },
                error: function (doctorList){
                    alert("查询医生失败!")
                }
            })
        })
        function show(doctorList){
            var docstr = "";
            for (var i = 0; i < doctorList.length; i++) {
                docstr += '<div class="media" style="border: 1px solid #93DAFF; width:350px ; height:150px ; background-color: #93DAFF ; display: inline-block ; margin: 20px ">'
                    + '<div class="media-left" style="width=50px ; height=150px ">'
                    + '<img src="/img/user/'
                    + (doctorList[i].dGender=='男'?1:2)
                    + '.jpg" style="width: 120px ; margin: 10px"/>'
                    + '</div> '
                    + '<div class="media-body" style="border-left: 1px solid blue;width=100px ;height=150px;padding: 10px">'
                    + '<p>姓名:' + doctorList[i].dName + '</p>'
                    + '<p>职称:' + doctorList[i].stationName + '</p>'
                    + '<p>简介:' + doctorList[i].dDesc + '</p>'
                    + '<p>挂号费:' + doctorList[i].registrationFee + '元</p>'
                    + '<a id="id" onclick="aa(' + doctorList[i].dId + ')" >预约</a>'
                    + '</div>'
                    + '</div>';
            }
            $("#body").append(docstr);
        }
        function aa(id){
            var depId="[[${departmentId}]]";
            var url = '/dmy/touserBookWork?workforcesDoctor=' + id +'&workforcesDepartment=' + depId;
            window.open(url,'_self')
        }


        </script>
</head>
<body>

    <div id="body">
        <h1>请选择医生</h1>
    </div>

</body>
</html>